<?php
/**
 * <li>Title: system_properties.php</li>
 * <li>Project: try app management</li>
 * <li>Package: /app/libs/SystemProperties</li>
 * <li>Description: This class holds all of the static properties of the system.  </li>
 * <li>Copyright: Copyright (c) 2008</li>
 * <li>Company: Infolex LLC </li>
 * <li>Created on 2009-9-17</li>
 *
 * @author xu_zhang
 * @version 1.0
 */
class SystemProperties{


	public static $app_host ;
	public static $app_host_webroot;
	public static $product_pageNumber=20;
	public static $user_message_number=20;
	public static $user_history_number=10;
	public static $img_names=array('g_img','g_img_small_one','g_img_small_two','g_img_small_three','g_img_small_four','g_img_small_five');
	public static $UPLOAD_ROOT_PATH=array();
	public static $path;
	public static $platform;
	public static $app_url;
	public static $product_link;
	public static $convert_link;
	public static $platform_logo='';
	public static $path_webroot="";
	public static $new_version="1";
	public static function get_table_name($prefix,$uid){
		return $prefix.'0';
	}
				
	public static $catname = array(
	0=>'--',
	1=>'旅游',
	2=>'开心猪倌',
	3=>'荣光医院',
	4=>'泡泡鱼',
	5=>'汽车工厂A',
	6=>'汽车工厂B',
	7=>'汽车工厂C',
	8=>'汽车工厂D',
    9=>'快来挖Wa1',
	10=>'快来挖Wa2',
    11=>'快来挖Wa3',
	12=>'快来挖Wa4',
	13=>'魔王名单1',
	14=>'魔王名单2',
	15=>'魔王名单3',
	16=>'魔王名单4',
	19=>'快乐岛主',
	20=>'楼一幢',
	-1=>'X',
	18=>'TEST',
	);
	
	public static $p_types = array(
	   'kuaidi'=>'普通快递', 
	   'guitai'=>'柜台领取', 
	   'shangjiafahuo'=>'商家直接发货', 
	   'coupon'=>'优惠码'
	);
	public static function init(){
		
		$hostname = $_SERVER['HTTP_HOST'];
		
		self::$platform = 'renren';
		self::$app_url = 'http://apps.renren.com/icantry/';
		self::$path_webroot="http://{$hostname}/webroot/";
		self::$path="http://{$hostname}/webroot/pic.php?u=";		
		self::$UPLOAD_ROOT_PATH['photo']=dirname(dirname(dirname(dirname(__FILE__)))).DS.'try'.DS.'app'.DS.'webroot'.DS.'product_img'.DS;
		self::$product_link = self::$app_url.'?type=details&product_id=%d';
		self::$convert_link = self::$app_url.'?type=convertdetails&product_id=%d';
		self::$platform_logo = 'http://s.xnimg.cn/imgpro/logo/viplogo-renren.png';
		self::$new_version = 1;
		switch ($hostname) {
			case 'myspace.try8.info':
			    {
				self::$platform = 'myspace';
				self::$app_url = 'http://opapps.myspace.cn/icantry/';
				self::$UPLOAD_ROOT_PATH['photo']=dirname(dirname(dirname(dirname(__FILE__)))).DS.'try'.DS.'app'.DS.'webroot'.DS.'product_img'.DS;
				self::$path_webroot="http://{$hostname}/tryapp/try/app/webroot/";
				self::$path="http://{$hostname}/tryapp/try/app/webroot/pic.php?u=";
				self::$product_link = self::$app_url.'?type=details&product_id=%d';
				self::$convert_link = self::$app_url.'?type=convertdetails&product_id=%d';
				self::$platform_logo = 'http://xfiles.cdnmyspace.cn/dir/header/v2/img/lg3.gif';
				self::$new_version = 0;
				break;
			}
			case 'yoka.try8.info':
			    {
				self::$platform = 'yoka';
				self::$app_url = 'http://space.yoka.com/plugin/plugin.php?appkey=10004';
				self::$UPLOAD_ROOT_PATH['photo']=dirname(dirname(dirname(dirname(__FILE__)))).DS.'try'.DS.'app'.DS.'webroot'.DS.'product_img'.DS;
				self::$path_webroot="http://{$hostname}/tryapp/try/app/webroot/";
				self::$path="http://{$hostname}/tryapp/try/app/webroot/pic.php?u=";
				self::$product_link = self::$app_url.'&type=details&product_id=%d';
				self::$convert_link = self::$app_url.'&type=convertdetails&product_id=%d';
				self::$platform_logo = 'http://images.yoka.com/pic/div/2010/newhead/logos.jpg';
				self::$new_version = 0;
				break;
			}
			case 'sina.try8.info':
				self::$app_url="http://sina.try8.info/";
				self::$UPLOAD_ROOT_PATH['photo']=dirname(dirname(dirname(dirname(__FILE__)))).DS.'try'.DS.'app'.DS.'webroot'.DS.'product_img'.DS;
				self::$path="http://{$hostname}/webroot/pic.php?u=";
				self::$path_webroot="http://{$hostname}/webroot/";
				self::$product_link = self::$app_url.'?&type=details&product_id=%d';
				self::$convert_link = self::$app_url.'?&type=convertdetails&product_id=%d';
				self::$platform = 'sina';
				self::$platform_logo = 'http://timg1.sjs.sinajs.cn/platformstyle/images/app/logo.png';
				self::$new_version = 1;
				break;	
							
			default: {
				break;
			}
		}
		
		
		self::$app_host = "http://{$hostname}/tryapp/TryAppManagement/index.php";
		self::$app_host_webroot = "http://{$hostname}/tryapp/TryAppManagement/app/webroot";
		
		
		
		
	}
	public function get_profile_url($uid){
		switch (self::$platform){
			case 'renren':
				return 	"http://renren.com/profile.do?id={$uid}";
			case 'myspace':
				return 	"http://myspace.cn/{$uid}";
			case 'yoka':
				return 	"http://space.yoka.com/{$uid}";
			case 'sina':
				return 	"http://t.sina.com.cn/{$uid}";
		}
		return '';
	}
	public  function get_product_url($id) {
	    return sprintf(self::$product_link, $id);
	}
	public  function get_convert_url($id) {
	    return sprintf(self::$convert_link, $id);
	}
}
SystemProperties::init();
//SystemProperties::$UPLOAD_ROOT_PATH['photo']='c:'.DS.'img'.DS;


?>